#!/usr/bin/env python
# -*- coding: utf-8 -*-
from core.poker import poker

'''
core.sort
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
排序
'''
class sort:
    def __init__(self):
        pass
    def sort(self,orderlist): 
        '''
        Feature
            sort(self,orderlist)
        Description
            降序排序
        Args
            orderlist:[],需要排序的数组
        Returns
            orderlist:[],排完成的数组
        '''  
        if orderlist:
            for i in range(0,len(orderlist)):
                for j in range(0,i):
                    a = orderlist[i].__value__
                    b = orderlist[j].__value__
                    if a>b:
                        temp=orderlist[j]
                        orderlist[j]=orderlist[i]
                        orderlist[i]=temp 
        return orderlist
    def sortasc(self,orderlist):
        '''
        Feature
            sortasc(self,orderlist)
        Desription
            升序排序
        Args
            orderlist:[]，需要排序的数组
        Returns
            orderlist:[]，排序完成的数组
        '''
        for i in range(0,len(orderlist)):
            for j in range(0,i):
                a = orderlist[i].__value__
                b = orderlist[j].__value__
                if a<b:
                    temp=orderlist[j]
                    orderlist[j]=orderlist[i]
                    orderlist[i]=temp 
        return orderlist